package com.nuoniu.sibanyun.mapper.cm;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nuoniu.sibanyun.entity.cm.CmContract;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 合同管理主表 Mapper 接口
 * </p>
 *
 * @author 小啊刚
 * @since 2021-10-21
 */
public interface CmContractMapper extends BaseMapper<CmContract> {

    /**
     * 获取合同管理最新编码
     * @author 小啊刚
     * @date 2021-10-22
     */
    @Select("select contract_code from cm_contract where company_id=#{companyId} and date_format(now(), #{dateStr})=date_format(create_date, #{dateStr}) order by create_date desc limit 1")
    String getCode(Integer companyId, String dateStr);
}
